{use master_page('admin/v_master')} 
{block content}

<?php 
// print_r($title) ;exit ; 
?>
<?php $ci = &get_instance(); 
function bl_usergroup($children,$level=1)
{
	$ci = & get_instance();
	foreach($children as $child)
	{
		$title = $child->title;
		$pad = "";
		for($i=0;$i<$level-1;$i++)
		{
			$pad = $pad . "----";
		}
		if($level == 1){
		$pad="+";
		}
		// $title = str_pad($title,'-',strlen($title)+level,STR_PAD_LEFT);

		echo "<option value='".$child->id."'>$pad$title</option>" ;
		if(sizeof($child->children)>0)
		{
			bl_usergroup($child->children,$level+1);
		}
	}
}
?>
<script>
$(document).ready(function(){

	$(".pmodel").each(function(){ 
		var id = $(this).attr("id");
		$(this).click(function(){ 
			var checked = $(this).attr("checked");
			$("."+id+"_cls").attr("checked",checked) ;  
			$("."+id+"_tbl tbody input[type=checkbox]").attr("checked",checked) ;
		});
		$("."+id+"_cls").click(function(){
			var tr = $(this).parent().parent();
			//alert(p.attr('class'));
			var checked = $(this).attr("checked");
			tr.find("table tbody input[type=checkbox]").attr("checked",checked) ; 
		});
	}) ; 
	
	
})
</script>

<form action="<?=$_SERVER['REQUEST_URI']?>" method="post"><div class="blank20" style="height:20px"></div>
<div id="tagscontent" class="right_box" >
	<table class="formtable" style="border:0px solid #cfcfcf;width:100%">
		<tr class='form_line'>
			<td class='title'><?=lang('usergroup_name')?></td>
			<td class='content'>
				<input name='p_name' size='20' value='<?=set_value('p_name', $name)?>' type='text' />  
				<?=form_error('p_name', '<font color="red">', '</font>')?>  
			</td>
		</tr> 
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="menu" value="1" width="30px">
								<b>菜单管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249);">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="menu_cls" type="checkbox"  value="1" >
								菜单管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 menu_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("menu","index")?"checked":"";?> value="menu~index"/>
												菜单列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("menu","edit")?"checked":"";?> value="menu~edit"/>
												添加/编辑菜单
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("menu","del")?"checked":"";?> value="menu~del"/>
												删除菜单
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("menu","order")?"checked":"";?>
												value="menu~order"/>
												菜单排序
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr><tr class=''>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="source" value="1" width="30px">
								<b>资源管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="source_cls" type="checkbox"  value="1" >
								文章分类管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 source_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article_class","index")?"checked":"";?> value="article_class~index"/>
												文章分类列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article_class","edit")?"checked":"";?> value="article_class~edit"/>
												添加/编辑文章分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article_class","del")?"checked":"";?> value="article_class~del"/>
												删除文章分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article_class","order")?"checked":"";?> value="article_class~order"/>
												文章分类排序
											</td>
										</tr>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article_class","moveto")?"checked":"";?> value="article_class~moveto"/>
												移动文章分类
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="source_cls" type="checkbox"  value="1" >
								单页分类管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 source_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page_class","index")?"checked":"";?> value="page_class~index"/>
												单页分类列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page_class","edit")?"checked":"";?> value="page_class~edit"/>
												添加/编辑单页分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page_class","del")?"checked":"";?> value="page_class~del"/>
												删除单页分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page_class","order")?"checked":"";?> value="page_class~order"/>
												单页分类排序
											</td>
										</tr>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page_class","moveto")?"checked":"";?> value="page_class~moveto"/>
												移动单页分类
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="source_cls" type="checkbox"  value="1" >
								链接分类管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 source_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link_class","index")?"checked":"";?> value="link_class~index"/>
												链接分类列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link_class","edit")?"checked":"";?> value="link_class~edit"/>
												添加/编辑链接分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link_class","del")?"checked":"";?> value="link_class~del"/>
												删除链接分类
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link_class","order")?"checked":"";?> value="link_class~order"/>
												链接分类排序
											</td>
										</tr>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link_class","moveto")?"checked":"";?> value="link_class~moveto"/>
												移动单页分类
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="source_cls" type="checkbox"  value="1" >
								留言板管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 source_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("guest_book","index")?"checked":"";?> value="guest_book~index"/>
												留言列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("guest_book","edit")?"checked":"";?> value="guest_book~edit"/>
												添加/编辑留言
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("guest_book","agree")?"checked":"";?> value="guest_book~agree"/>
												留言审核
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("guest_book","del")?"checked":"";?> value="guest_book~del"/>
												删除留言
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr> 
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245);">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="user" value="1" width="30px">
								<b>用户管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="user_cls" type="checkbox"  value="1" >
								用户管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 user_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("user","index")?"checked":"";?> value="user~index"/>
												用户列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("user","edit")?"checked":"";?> value="user~edit"/>
												添加/编辑用户
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("user","del")?"checked":"";?> value="user~del"/>
												删除用户
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("user","order")?"checked":"";?> value="user~order"/>
												用户排序
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="user_cls" type="checkbox"  value="1" >
								用户组管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 user_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("usergroup","index")?"checked":"";?> value="usergroup~index"/>
												用户组列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("usergroup","edit")?"checked":"";?> value="usergroup~edit"/>
												添加/编辑用户组
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("usergroup","del")?"checked":"";?> value="usergroup~del"/>
												删除用户组
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("usergroup","order")?"checked":"";?> value="usergroup~order"/>
												用户组排序
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="net" value="1" width="30px">
								<b>网站管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="2" width="120" class="col" valign="center">
								<input class="net_cls" type="checkbox"  name="acls[]"  
								<?php echo $usergroup->permission("site_info","edit")?"checked":"";?> value="site_info~edit" >
								基本信息
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="net_cls" type="checkbox"  value="1" >
								模版管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 net_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("template","index")?"checked":"";?> value="template~index"/>
												模版列表
											</td>
											
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("template","apply")?"checked":"";?> value="template~apply"/>
												启用模版
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("template","edit")?"checked":"";?> value="template~edit"/>
												模版编辑
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr> 
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="article" value="1" width="30px">
								<b>文章管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="article_cls" type="checkbox"  value="1" >
								文章管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 article_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article","index")?"checked":"";?> value="article~index"/>
												文章列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article","edit")?"checked":"";?> value="article~edit"/>
												添加/编辑文章
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article","del")?"checked":"";?> value="article~del"/>
												删除文章
											</td>  
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("article","moveto")?"checked":"";?> value="article~moveto"/>
												移动文章
											</td>  
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr> 
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="page" value="1" width="30px">
								<b>单页管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="page_cls" type="checkbox"  value="1" >
								单页管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 page_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page","index")?"checked":"";?> value="page~index"/>
												单页列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page","edit")?"checked":"";?> value="page~edit"/>
												添加/编辑单页
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page","del")?"checked":"";?> value="page~del"/>
												删除单页
											</td> 
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("page","moveto")?"checked":"";?> value="page~moveto"/>
												移动单页
											</td> 
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr> 
		<tr>
			<td colspan='2'>
				<table class="datatable1"  width="100%" border="0" cellspacing="0" cellpadding="2">
					<tbody>
						<tr style="background-color: rgb(245, 245, 245); ">
							<td colspan="4" class="row" valign="center">
								<input class="pmodel"  type="checkbox" id="link" value="1" width="30px">
								<b>链接管理</b>
							</td>
						</tr>
						<tr style="background-color: rgb(249, 249, 249); width:727px">
							<td colspan="1" width="120" class="col" valign="center">
								<input class="link_cls" type="checkbox"  value="1" >
								链接管理
							</td>
							<td colspan="3" class="col" valign="center">
								<table class="datatable2 link_tbl" border="0" cellspacing="0" cellpadding="2">
									<tbody>
										<tr style="background-color: rgb(245, 245, 245); ">
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link","index")?"checked":"";?> value="link~index"/>
												链接列表
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link","edit")?"checked":"";?> value="link~edit"/>
												添加/编辑链接
											</td>
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link","del")?"checked":"";?> value="link~del"/>
												删除链接
											</td> 
											<td class="unit">
												<input class="normal" type="checkbox" name="acls[]" 
												<?php echo $usergroup->permission("link","moveto")?"checked":"";?> value="link~moveto"/>
												移动链接
											</td> 
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<!--tr class='form_line'>
			<td class='title'><?=lang('usergroup_type')?></td>
			<td class='content' width="60%">
				<input name='p_type' size='20' value='<?=set_value('p_type', $type)?>' type='text' />  
				<?=form_error('p_type', '<font color="red">', '</font>')?>  
			</td>
		</tr--> 
	</table> 
	<div class="blank20"style="height:20px"></div>
	<!--input name ="p_usergroup_name" value="<?php echo $this->input->get('name');?>" type="hidden"/-->	
	<input type="submit" name="submit" value=" 提交 " class="btn_a">
</div>
</form>
{end}